


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
            "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>

<HEAD>

<TITLE>Setting Up CVS and SSH</TITLE>

<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="hevea 1.08">
<STYLE type="text/css">
.toc{list-style:none;}
.title{margin:auto;text-align:center}
.center{text-align:center;margin-left:auto;margin-right:auto;}
.flushleft{text-align:left;margin-left:0ex;margin-right:auto;}
.flushright{text-align:right;margin-left:auto;margin-right:0ex;}
DIV TABLE{margin-left:inherit;margin-right:inherit;}
PRE{text-align:left;margin-left:0ex;margin-right:auto;}
BLOCKQUOTE{margin-left:4ex;margin-right:4ex;text-align:left;}
.part{margin:auto;text-align:center}
</STYLE>
</HEAD>

<BODY >
<!--HEVEA command line is: /usr/bin/hevea -exec xxdate.exe ../../cvssetup -->
<!--HTMLHEAD-->
<!--ENDHTML-->
<!--PREFIX <ARG ></ARG>-->
<!--CUT DEF section 1 -->


<TABLE CLASS="title">
<TR><TD>
<H1 CLASS="titlemain">Setting Up CVS and SSH</H1>
<H3 CLASS="titlerest">Scott McPeak &nbsp;&nbsp;George Necula</H3></TD>
</TR></TABLE><BR>
 This document is intended to get you started with the tools that are
necessary for checking out stuff out of the manju CVS repository. These
instructions work on Linux and Windows (NT4.0, 2000, XP and also less reliably
on 95/98/Me).<BR>
<BR>
<!--TOC section If you want to use Windows-->

<H2 CLASS="section"><A NAME="htoc1">1</A>&nbsp;&nbsp;If you want to use Windows</H2><!--SEC END -->

<!--TOC subsection Get <TT>cygwin</TT>-->

<H3 CLASS="subsection"><A NAME="htoc2">1.1</A>&nbsp;&nbsp;Get <TT>cygwin</TT></H3><!--SEC END -->

You must have a bunch of Unix tools installed on your machine. (In the future
we might be able to avoid these but for now you are better off with them.).
Here is what I (George) do to install Cygwin. You need a good network
connection for this. 
<UL CLASS="itemize"><LI CLASS="li-itemize">
Create a directory <TT>C:\Download\cygwin</TT>
<LI CLASS="li-itemize">Go to <A HREF="http://sources.redhat.com/cygwin"><TT>http://sources.redhat.com/cygwin</TT></A> and click <TT>Install
cygwin</TT> icon. Download <TT>setup.exe</TT> to the directory you just created.
<LI CLASS="li-itemize">Run <TT>setup.exe</TT> and select &#8220;Download to local directory&#8221;. Select all
the packages. It is especially important to select all packages under
&#8220;Devel&#8221; category. If you want to use OCaml for other projects as well, I
also suggest that you select the XFree86-bin, XFree86-lib and XFree86-prog as
well. This will take a while (&nbsp; 30 minutes)
<LI CLASS="li-itemize">Run <TT>setup.exe</TT> again and now select to &#8220;Install from local
directory&#8221;. It is best to <B>deselect</B> the <TT>tetex</TT> package since I found
it to interfere with other installations of Latex.
<LI CLASS="li-itemize">I choose <TT>C:\Programs\cygwin</TT> 
as the home for <TT>cygwin</TT>, I use <TT>DOS</TT> as the default text file and I
choose &#8220;Install for All&#8221;. 
<LI CLASS="li-itemize">Add <TT>C:\Programs\cygwin\bin</TT> to your
PATH. You must put it in the &#8220;System Variables&#8221; PATH (In Control Panel/System/Advanced/Environment
Variables&#8221; and <B>put it first</B> so that it comes before the default
c:/WinNT/system32. You can verify that you got it right if you get
<TT>/usr/bin/find</TT> when you run <TT>which find</TT>. 
</UL>
If you get a compilation error in file &#8220;cltkImg.c&#8221; while you compile Ocaml
v 3.06, then you should patch the Ocaml sources as explained at
<A HREF="http://groups.google.com/groups?selm=fa.i2v96ov.1p7cmbc%40ifi.uio.no"><TT>http://groups.google.com/groups?selm=fa.i2v96ov.1p7cmbc%40ifi.uio.no</TT></A>
(It is easy).<BR>
<BR>
<!--TOC subsection Customize <TT>ssh</TT>-->

<H3 CLASS="subsection"><A NAME="htoc3">1.2</A>&nbsp;&nbsp;Customize <TT>ssh</TT></H3><!--SEC END -->
<A NAME="sec-win-ssh"></A>
Set the environment variable <TT>HOME</TT> to point to your home directory. I use
 <TT>C:\Necula</TT>. <BR>
<BR>
For some strange reason <TT>ssh</TT> does not see this <TT>HOME</TT> variable and
insists on looking at <TT>/home/necula</TT> instead. So I create a link as follows:
<PRE CLASS="verbatim">
bash
cd /
mkdir home
ln -s /cygdrive/c/Necula /home/necula
</PRE>
<!--TOC section Configure CVS-->

<H2 CLASS="section"><A NAME="htoc4">2</A>&nbsp;&nbsp;Configure CVS</H2><!--SEC END -->

<!--TOC subsection <TT>.cvsrc</TT>-->

<H3 CLASS="subsection"><A NAME="htoc5">2.1</A>&nbsp;&nbsp;<TT>.cvsrc</TT></H3><!--SEC END -->

Create a ~/.cvsrc file with two lines in it: 
<PRE CLASS="verbatim">
cvs -q
update -d
</PRE>
 <!--TOC subsection <TT>.ssh/config</TT>-->

<H3 CLASS="subsection"><A NAME="htoc6">2.2</A>&nbsp;&nbsp;<TT>.ssh/config</TT></H3><!--SEC END -->

Create a ~/.ssh/config file with this line in it:
<PRE CLASS="verbatim">
ForwardX11 yes
</PRE>
 If the <TT>DISPLAY</TT> environment variable is set when you invoke <TT>ssh</TT> (e.g.
to <TT>localhost:0.0</TT> then <TT>ssh</TT> will do automatic X11 forwarding for you.
This is not useful for the use of <TT>ssh</TT> with <TT>cvs</TT> but when you want to do
remote login. <BR>
<BR>
<!--TOC subsection Using CVS with <TT>ssh</TT>-->

<H3 CLASS="subsection"><A NAME="htoc7">2.3</A>&nbsp;&nbsp;Using CVS with <TT>ssh</TT></H3><!--SEC END -->

Note: these instructions appear to work even on Windows with the <TT>ssh</TT> and
<TT>cvs</TT> that ships with <TT>cygwin</TT> (provided that you have installed
<TT>cygwin</TT> and <TT>ssh</TT> as discussed in Section&nbsp;<A HREF="#sec-win-ssh">1.2</A>).<BR>
<BR>
Set the environment variable <TT>CVS_RSH</TT> to <TT>ssh</TT>. <BR>
<BR>
Now you can use cvs with ssh but you will have to type the remote password
 everytime you run cvs. <BR>
<BR>
If you want to be able to use <TT>ssh</TT> without typing a password everytime
here is what you can do. These instructions are for the case when you use one
of the newer versions of SSH that support the protocol 2. 
<OL CLASS="enumerate" type=1><LI CLASS="li-enumerate">
 If you have a DSA private key that is already authorized on 
 the server, copy it to <TT>~/.ssh/id_dsa</TT> and you 
 should be done.
 <LI CLASS="li-enumerate">Otherwise
 <OL CLASS="enumerate" type=a><LI CLASS="li-enumerate">
 Run <TT>ssh-keygen -t dsa</TT> to create a private key. 
 Choose a passphrase and remember it. 
 If you do not have a passphrase then anybody who gets
 access to your machine will also be able to log in to the server. This
 step should create the files <TT>id_dsa.pub</TT> and <TT>id_dsa</TT> in your 
 <TT>~/.ssh</TT> directory.
 <LI CLASS="li-enumerate">Copy the public key to the server (say manju.cs.berkeley.edu).
 Make sure you append the key to <B>authorized_keys2</B>, not to <B>authorized_keys</B>. 
 <PRE CLASS="verbatim">
             cd ~
             scp .ssh/id_dsa.pub manju:~/.ssh/newpublicid
             ssh manju
             cd .ssh
             cat newpublicid &gt;&gt; authorized_keys2
             rm newpublicid
             </PRE></OL>
</OL>
If you want you can even start an agent to do the authentication for
you. The steps are different for Linux or Windows:
 <UL CLASS="itemize"><LI CLASS="li-itemize">
 On Linux or on Windows if you work from within <TT>bash</TT> you can run
 <PRE CLASS="verbatim"> 
           eval `ssh-agent`
           ssh-add
        </PRE>
 The first step starts the agent and the second on loads your identity
 in the agent. In this latter step you will be asked to enter your
 passphrase. 
 <LI CLASS="li-itemize">At the Windows command prompt (<TT>cmd.exe</TT>) you cannot just run
 those commands. Instead you have to download
 <A HREF="http://raw.cs.berkeley.edu/winssh-agent.cmd">this batch file
 (<B>do not execute it</B>)</A>, 
 put it somewhere in your path and then run it instead of the above
 sequence of commands. 
 </UL>
<!--TOC section Using CVS-->

<H2 CLASS="section"><A NAME="htoc8">3</A>&nbsp;&nbsp;Using CVS</H2><!--SEC END -->

You should read the rest only if you have not used CVS before. <BR>
<BR>
CVS is used to synchronize changes to the project across multiple
developers. See the CVS website for detailed information<BR>
<BR>
<A HREF="http://www.cvshome.org/"><TT>http://www.cvshome.org/</TT></A><BR>
<BR>
There are a few common commands you'll need. Each of these is to be run
in the base 'cil' directory (the one with 'regrtest'):
<UL CLASS="itemize"><LI CLASS="li-itemize">
<TT>cvs [-n] update -d [filename]</TT><BR>
<BR>
This retrieves any changes recently committed by others. This is
 usually necessary before you can commit your own changes. It is a
 good idea to run the fast regression test ('regrtest') before and
 after doing "cvs update" so you can know whether it was you or the
 update which broke something.<BR>
<BR>
The optional -n flag tells CVS to not actually change any of your
 files. This is useful for querying the status of the repository.<BR>
<BR>
The -d argument tells cvs to create on your machine any new directories
 that somebody might have checked in. By default cvs does not create new
 directories. This flag is so useful that many people find it useful to
 create a ~/.cvsrc file with one line containing "update -d" in it.
 This way you don't have to specify the flag all the time.<BR>
<BR>
If you specify a filename (after cd'ing to the directory containing it),
 only that file will be updated, otherwise everything in the current
 directory and below is updated. Run this in the top-level project
 directory to update the entire project. A useful idiom for undoing all of
 your changes is "cd dir; rm file; cvs update file".<BR>
<BR>
<LI CLASS="li-itemize"><TT>cvs commit [filename]</TT><BR>
<BR>
This pushes your changes into the repository, so that the next time
 someone does "cvs update" they will get your changes. Please try to
 only commit when the regression test script passes.<BR>
<BR>
If you specify a filename, only that file will be committed, otherwise
 everything in the current directory and below is checked in. Run this in
 the top-level project directory to check all of your changes in.<BR>
<BR>
<LI CLASS="li-itemize"><TT>cvs add filename</TT><BR>
<BR>
This adds a new file to the repository. It isn't visible in the
 repository until you do a commit.
</UL>
<!--TOC section Useful Links-->

<H2 CLASS="section"><A NAME="htoc9">4</A>&nbsp;&nbsp;Useful Links</H2><!--SEC END -->

<UL CLASS="itemize"><LI CLASS="li-itemize">
 Tutorial on ML: 
 <LI CLASS="li-itemize">Documentation and sources for CVS:
 <A HREF="http://www.cvshome.org/"><TT>http://www.cvshome.org/</TT></A></UL>
<!--HTMLFOOT-->
<!--ENDHTML-->
<!--FOOTER-->
<HR SIZE=2><BLOCKQUOTE CLASS="quote"><EM>This document was translated from L<sup>A</sup>T<sub>E</sub>X by
</EM><A HREF="http://pauillac.inria.fr/~maranget/hevea/index.html"><EM>H<FONT SIZE=2><sup>E</sup></FONT>V<FONT SIZE=2><sup>E</sup></FONT>A</EM></A><EM>.</EM></BLOCKQUOTE></BODY>
</HTML>
